package com.pth.action;

import com.opensymphony.xwork2.ActionSupport;
import com.pth.exception.MyException;
import com.pth.model.Notice;
import com.pth.service.NoticeService;

public class GetSingleNAction extends ActionSupport{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Notice notice;
	private NoticeService noticeService;
	private int id;

	public NoticeService getNoticeService() {
		return noticeService;
	}

	public void setNoticeService(NoticeService noticeService) {
		this.noticeService = noticeService;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Notice getNotice() {
		return notice;
	}

	public void setNotice(Notice notice) {
		this.notice = notice;
	}
	
	@Override
	public String execute() throws Exception {
	
		
		notice=noticeService.getNoticeByid(id);
		MyException myException=new MyException();
		if(notice==null){
			
			throw(myException);
		}
		return SUCCESS;
	}
	
	
}
